/**
 * Created by luqidong on 2017/12/11.
 */
import axios from './http';
import {USER_URI,MASTER_URI} from '../uitls/ajaxUrl';
/**
 * 获取商品列表
 * @param token
 * @returns {*}
 */
export function getProListR(token) {
    if(token) {
        return axios.get(`${MASTER_URI}/mall/all`, {
            headers: {
                token
            }
        })
    }
    return axios.get(`${MASTER_URI}/mall/all`)
}
export function getproinfo(id) {
    if(token) {
        return axios.get(`${MASTER_URI}/mall/all`, {
            headers: {
                token
            }
        })
    }
    return axios.get(`${MASTER_URI}/mall/all`)
}
/**
 * 购买商品
 * @param id
 * @param uname
 * @param address
 * @param contact
 * @param token
 * @returns {*}
 */
export function buyProductionByIdR({id, uname, address, contact, token}) {
    return axios.post(`${MASTER_URI}/mall/buy`, {
        name: uname,
        address,
        contact,
        id
    }, {
        headers: {
            token
        }
    })
}
/**
 * 通过id¬查询商品信息
 * @param id
 * @returns {*}
 */
export function getproInfoById(id) {
    return axios.get(`${MASTER_URI}/mall/byId?id=${id}`);
}
/**
 * 获取银行卡列表
 * @param params
 * @returns {*}
 */
export function getBankCards(params) {
    return axios.get(`${USER_URI}/Handler.ashx?action=901&params=${JSON.stringify(params)}`);
}
/**
 * 兑换列表
 * @param token
 * @returns {*}
 */
export function getExchargeListR(token) {
    return axios.get(`${MASTER_URI}/mall/order`, {
        headers: {
            token
        }
    });
}